import { defineStore } from 'pinia'

export const useWorkStore = defineStore('workInfo', {
  // 为了完整类型推理，推荐使用箭头函数
  state: () => {
    return {
      // 所有这些属性都将自动推断出它们的类型
      place: '重庆',
      company: '马上消费'
    }
  },
  getters: {
    myCompany: (state) => '工作单位：' + state.company,
    nameCompany(): string {
      return this.myCompany + '中华人民共和国'
    },
    provinceCompany() {
      return this.myCompany + '重庆'
    },
    bossCompany: (state) => {
      return (boss:string) => state.company + boss
    }
  },
  actions: {
    changeCompany() {
      this.company = this.company + Math.random()
    }
  }
})
